#include "pyObject.hpp"
#include "runtime/global.hpp"
#include "runtime/functionObject.hpp"

void PyObject::print() {
    klass()->print(this);
}

PyObject *PyObject::add(PyObject* y) {
    return klass()->add(this, y);
}

PyObject *PyObject::greater(PyObject* y) {
    return klass()->greater(this, y);
}

PyObject *PyObject::less(PyObject* y) {
    return klass()->less(this, y);
}

PyObject *PyObject::equal(PyObject* y) {
    return klass()->equal(this, y);
}

PyObject *PyObject::len() {
    return klass()->len(this);
}

PyObject *PyObject::getAttr(PyObject* y) {
    PyObject* result = klass()->dict()->get(y);
    if(result == Global::PyNone){
        return result;
    }

    if(MethodObject::isFunction(result)){
        result = new MethodObject((FunctionObject*)result, this);
    }
    return result;
}
